package com.ugoodtech.mdcc.core.model.mapper;

import com.ugoodtech.mdcc.core.model.entity.Brand;
import com.ugoodtech.mdcc.core.model.entity.BrandExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface BrandMapper {
    @SelectProvider(type=BrandSqlProvider.class, method="countByExample")
    int countByExample(BrandExample example);

    @DeleteProvider(type=BrandSqlProvider.class, method="deleteByExample")
    int deleteByExample(BrandExample example);

    @Delete({
        "delete from brand",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into brand (id, creation_time, ",
        "deleted, enabled, update_time, ",
        "brand_name)",
        "values (#{id,jdbcType=BIGINT}, #{creationTime,jdbcType=TIMESTAMP}, ",
        "#{deleted,jdbcType=BIT}, #{enabled,jdbcType=BIT}, #{updateTime,jdbcType=TIMESTAMP}, ",
        "#{brandName,jdbcType=VARCHAR})"
    })
    int insert(Brand record);

    @InsertProvider(type=BrandSqlProvider.class, method="insertSelective")
    int insertSelective(Brand record);

    @SelectProvider(type=BrandSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="creation_time", property="creationTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="deleted", property="deleted", jdbcType=JdbcType.BIT),
        @Result(column="enabled", property="enabled", jdbcType=JdbcType.BIT),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="brand_name", property="brandName", jdbcType=JdbcType.VARCHAR)
    })
    List<Brand> selectByExample(BrandExample example);

    @Select({
        "select",
        "id, creation_time, deleted, enabled, update_time, brand_name",
        "from brand",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="creation_time", property="creationTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="deleted", property="deleted", jdbcType=JdbcType.BIT),
        @Result(column="enabled", property="enabled", jdbcType=JdbcType.BIT),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="brand_name", property="brandName", jdbcType=JdbcType.VARCHAR)
    })
    Brand selectByPrimaryKey(Long id);

    @UpdateProvider(type=BrandSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Brand record, @Param("example") BrandExample example);

    @UpdateProvider(type=BrandSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Brand record, @Param("example") BrandExample example);

    @UpdateProvider(type=BrandSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Brand record);

    @Update({
        "update brand",
        "set creation_time = #{creationTime,jdbcType=TIMESTAMP},",
          "deleted = #{deleted,jdbcType=BIT},",
          "enabled = #{enabled,jdbcType=BIT},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP},",
          "brand_name = #{brandName,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(Brand record);
}